using System.Collections.Generic;
using UnityEngine;

public class StarsTable : MonoBehaviour
{
	public UITable table;

	public UISprite starPrefab;

	protected List<GameObject> stars = new List<GameObject>();

	protected int numStars;

	public GameObject lastStar
	{
		get
		{
			if (stars.Count >= numStars && stars.Count > 0)
			{
				return stars[numStars - 1];
			}
			return null;
		}
	}

	public void InitWithStars(int numStars)
	{
		this.numStars = numStars;
		int num = 0;
		for (num = 0; num < numStars; num++)
		{
			if (num >= stars.Count)
			{
				stars.Add(NGUITools.AddChild(table.gameObject, starPrefab.cachedGameObject));
			}
			GameObject obj = stars[num];
			UITools.SetActive(obj, true);
		}
		for (; num < stars.Count; num++)
		{
			GameObject obj2 = stars[num];
			UITools.SetActive(obj2, false);
		}
		table.Reposition();
	}
}
